﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.R.RabbitRoot.Infrastructure.Interface
{
    /// <summary>
    /// 公共仓储
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IBaserepository<T> where T : class
    {
        /// <summary>
        /// 获取全部数据
        /// </summary>
        /// <returns></returns>
        IQueryable<T> GetAll();
        /// <summary>
        /// 异步获取全部数据
        /// </summary>
        /// <returns></returns>
        Task<List<T>> GatAsync();
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> AddAsync(T entity);
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> UpdateAsync(T entity);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> DeleteAsync(T entity);
        /// <summary>
        /// 真删除
        /// </summary>
        /// <returns></returns>
        Task<int> removeAsync(T entity);
    }
}
